home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_aet_doormove.cog < prev    next >
Text File  |  1999-11-15  |  9KB  |  379 lines

  1. # Jones 3D Cog Script
  2. #
  3. # aet_DoorMove.cog
  4. #
  5. # [TL] [Whip by RT :)]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. #
  9. # ========================================================================================
  10. symbols
  11.  
  12. message        startup
  13. message        arrived
  14. message        activated
  15. message        callback
  16. message        damaged
  17.  
  18. thing        player                            local
  19. thing        indy0                                    # Indy actor 1.
  20. thing        door0                                    # Door.
  21. thing        probe0                                    # Probe that is whipped to open door.                            
  22. thing        probeA                                    # Charaged probe for probe 0.    
  23.  
  24. thing        spritespot
  25. thing        cam0                                    # Camera 1.
  26. thing        cam0_target                                # Camera 1 target.
  27.  
  28. thing        sender                            local
  29.  
  30. keyframe    in_whipit=in_whip_outprobe.key     local
  31. keyframe    wh_whipit=wh_whip_outprobe.key    local
  32.  
  33. keyframe    in_ravel=in_attack_ravel_whip.key    local
  34. keyframe    wh_ravel=wh_attack_whip_ravel.key    local
  35.  
  36. int            done0=0                            local    # Flag for when door is done opening.
  37. int            done1=0                            local    # Flag for when wrong whip is done being used.
  38. int            curcam                            local
  39.  
  40. thing        whipThing                        local
  41.  
  42. int            curindy                            local    # Current indy actor at any given time. 
  43. int            curarm                            local    # Current door at any time.
  44. int            indyAnim                        local
  45. int            whipAnim                        local
  46. int            sprite0                            local
  47.  
  48. int            callNum                            local
  49. int            joint                            local
  50.  
  51. int            silverWhip=0                    local
  52.  
  53. sound        success_cue=mus_shw_meltice.wav    local
  54. sound        charge=aet_mr_chargeup.wav        local    # Whip charge.
  55. sound        whip=gen_whip_fire.wav            local
  56. sound        roll=gen_whip_ravel.wav            local
  57.  
  58. template    whipTpl=+whip_actor                local
  59. template    sparks0=mophiaSparksLg            local
  60. template    chargesprite=+tower_glow        local
  61.  
  62. model        whipHand=weap_whip.3do            local
  63.  
  64. cog            doortalk        
  65.  
  66. flex        wrongwhip                        local    # Subroutine for when wrong whip cutscene is played.
  67.  
  68. end
  69.  
  70. # ========================================================================================
  71. code
  72.  
  73. startup:
  74.  
  75. player = GetLocalPlayerThing();
  76.  
  77. //Sleep(1.0);              # temp test...take out later...
  78. //SetWhipElectric(1);        # temp test...take out later... 
  79.  
  80. # Fade charged probe out.
  81. ThingFadeAnim(probeA, 1.0, 0.0, 0.1, 0);
  82. SetCollideType(probeA, 0);
  83.  
  84. return;
  85.  
  86. # ........................................................................................
  87. activated:
  88.  
  89. # Code for activating door with nothing or wrong thing.
  90. if (GetSenderRef() == door0)
  91.     {
  92.     # Small cutscene for activating doors with no item.
  93.     if (MakeMeStop() == -1)
  94.         return;
  95.     DeselectWeaponWait(player);
  96.     StartCutscene(0);
  97.     PlayMode(player, 60, 0);
  98.     SendMessageEx(doorTalk, user4, player, 0, 0, 0);
  99.     while (global15 == 0)
  100.         {
  101.         #Wait for line to finish...
  102.         Sleep(0.01);
  103.         }
  104.     ResetThing(player);
  105.     ClearActorFlags(player, 0x200000);
  106.     EndCutscene();   
  107.     }
  108.     
  109. return;
  110.  
  111. # ........................................................................................
  112. damaged:
  113.  
  114. # Code for whipping probe to cause door to open.
  115. if ((GetParam(1) == 0x800) && (GetSenderRef() == probe0))
  116.     {
  117.     if (done0 == 1) return;
  118.     done0 = 1;
  119.     silverWhip = 1;
  120.     
  121.     # Prep the indy actor.
  122.     ResetCameraFOV(0, 0);
  123.     curcam = GetCurrentCamera();
  124.     SetActorFlags(player, 0x200000);
  125.     StopThing(player);
  126.  
  127.     # Play music.
  128.     PlaySoundLocal(success_cue, 1.0, 0.0, 0x0, 0);
  129.  
  130.     # Set up camera.
  131.     SetCameraSecondaryFocus(2, cam0_target);
  132.     SetCameraFocus(2, cam0);
  133.     SetCameraLookInterp(2, 0);
  134.     SetCameraPosInterp(2, 0);
  135.     Sleep(0.01);
  136.     SetCurrentCamera(2);
  137.     SetCameraFOV(100, 0, 0);
  138.     Sleep(0.01);
  139.     SetCameraFOV(90, 1, 2.0);
  140.  
  141.     # Prep indy. 
  142.     CopyPlayerHolsters(player, indy0); # Make sure actor has matching props.
  143.     ClearThingFlags(indy0, 0x80000);
  144.     SetThingFlags(player, 0x80000); 
  145.  
  146.     StartCutScene(1);
  147.  
  148.     ChangeInv(player, 2, -1.0); # Decrease bin by 1...
  149.  
  150.     # Prep whip.
  151.     whipThing = AttachThingToThingMesh(indy0, whipTpl, 15);
  152.     SetThingMesh(indy0, 15, whipHand, 0);
  153.  
  154.     # Do the whip swing fake animation...
  155.     curindy = indy0;
  156.     curarm = door0;
  157.     //CaptureThing(indy0); # Make sure we get the callback message...
  158.     indyAnim = PlayKey(indy0, in_whipit, 5, 0x14, 0); # Indy anim...
  159.  
  160.     CaptureThing(whipThing); # Make sure we get the callback message...
  161.     whipAnim = PlayKey(whipThing, wh_whipit, 5, 0x14, 0); # Whip anim...
  162.     
  163.     Sleep(1.5);
  164.  
  165.     # Add VFX here...
  166.  
  167.     # Cross fade the two probes to show charging.
  168.     ThingFadeAnim(probe0, 1.0, 0.0, 2.0, 0);
  169.     ThingFadeAnim(probeA, 0.0, 1.0, 2.0, 0);
  170.     
  171.     PlaySoundLocal(charge, 1, 0, 0x0, 0);
  172.     CreateThing(sparks0, probe0);
  173.     CreateThing(sparks0, probe0);
  174.     sprite0 = CreateThing(chargesprite, spritespot);
  175.     
  176.     AnimateSpriteSize(sprite0, '0.25 0.25 1.0', '0.35 0.35 0.0', 1.0);
  177.     
  178.     # Wait for whip action to go by.
  179.     Sleep(2.5);
  180.     }
  181. # Code for whipping probe with no electric whip.
  182. if ((GetParam(1) == 0x10) && (GetSenderRef() == probe0))
  183.     {
  184.     if (done1 == 1) return;
  185.     done1 = 1;
  186.     silverWhip = 0;
  187.     
  188.     # Prep the indy actor.
  189.     ResetCameraFOV(0, 0);
  190.     curcam = GetCurrentCamera();
  191.     SetActorFlags(player, 0x200000);
  192.     StopThing(player);
  193.  
  194.     SetCameraSecondaryFocus(2, cam0_target);
  195.     SetCameraFocus(2, cam0);
  196.     SetCameraLookInterp(2, 0);
  197.     SetCameraPosInterp(2, 0);
  198.     Sleep(0.01);
  199.     SetCurrentCamera(2);
  200.     SetCameraFOV(100, 0, 0);
  201.     Sleep(0.01);
  202.     SetCameraFOV(90, 1, 2.0);
  203.  
  204.     # Prep indy. 
  205.     CopyPlayerHolsters(player, indy0); # Make sure actor has matching props.
  206.     ClearThingFlags(indy0, 0x80000);
  207.     SetThingFlags(player, 0x80000); 
  208.  
  209.     StartCutScene(1);
  210.  
  211.     # Prep whip.
  212.     whipThing = AttachThingToThingMesh(indy0, whipTpl, 15);
  213.     SetThingMesh(indy0, 15, whipHand, 0);
  214.  
  215.     # Do the whip swing fake animation...
  216.     curindy = indy0;
  217.     curarm = door0;
  218.     //CaptureThing(indy0); # Make sure we get the callback message...
  219.     indyAnim = PlayKey(indy0, in_whipit, 5, 0x14, 0); # Indy anim...
  220.  
  221.     CaptureThing(whipThing); # Make sure we get the callback message...
  222.     whipAnim = PlayKey(whipThing, wh_whipit, 5, 0x14, 0); # Whip anim...
  223.     
  224.     Sleep(1.5);
  225.     
  226.     PlaySoundLocal(whip, 1.0, 0.0, 0x0, 0);
  227.     
  228.     # Wait for action.
  229.     Sleep(2.5);
  230.     }
  231.  
  232. return;
  233.  
  234. # ........................................................................................
  235. callback:
  236.  
  237.     sender = GetSenderRef();
  238.     callNum = GetParam(1);
  239.  
  240.     if (sender == curindy)
  241.     {
  242.         # Callback from whipping animations.
  243.         if (GetParam(1) == 24)
  244.         {
  245.             # Stop animations.
  246.             StopKey(curindy, indyAnim, 0);
  247.             StopKey(whipThing, whipAnim, 0);
  248.         
  249.             # Start wind-ups...
  250.             PlayKey(curindy, in_ravel, 4, 0x12, 0);
  251.             if (whipThing != -1)
  252.             {
  253.                 CaptureThing(whipThing);
  254.                 PlayKey(whipThing, wh_ravel, 4, 0x12, 0);
  255.             }
  256.             PlaySoundThing(roll, curindy, 1, -1, -1, 0x80);
  257.         
  258.             # If callback if from regular whip...
  259.             if (done1 == 1)
  260.             {
  261.                 call wrongwhip;
  262.             }
  263.             # If callback is from electrowhip move door to frame.
  264.             if (done0 == 1)
  265.             {
  266.                 MoveToFrame(curarm, 1, 1.0);
  267.             }
  268.         }
  269.     }
  270.     else if (sender == whipThing)
  271.     {
  272.         if (callNum == 28)
  273.         {
  274.             for (joint = 12; joint > 4; joint = joint - 1)
  275.             {
  276.                 AmputateJoint(whipThing, joint);
  277.             }
  278.         }
  279.         else if (callNum == 29)
  280.         {
  281.             AmputateJoint(whipThing, 4);
  282.         }
  283.         else if (callNum == 30)
  284.         {
  285.             AmputateJoint(whipThing, 3);
  286.         }
  287.         else if (callNum == 31)
  288.         {
  289.             ReleaseThing(whipThing);
  290.             AmputateJoint(whipThing, 2);
  291.  
  292.             if (whipThing != -1)
  293.             {
  294.                 DetachThingMesh(whipThing);
  295.                 SetWeaponModel(curindy, 2); 
  296.             }
  297.             whipThing = -1;
  298.  
  299.             if (silverWhip) # Electric whip
  300.             {
  301.                 if (GetInv(player, 2) < 1) # Turn it off if it's outta juice...
  302.                 {
  303.                     SetWhipElectric(0);
  304.     
  305.                     SetInv(player, 2, 1.0); # Reset the bin to 1...
  306.                     SetInvAvailable(player, 2, 1);
  307.  
  308.                     silverwhip = 0;
  309.                 }
  310.             }
  311.         }
  312.     }
  313.  
  314. return;
  315.  
  316. # ........................................................................................
  317. arrived:
  318.  
  319. # Once the doors are open...
  320. if (GetSenderRef() == door0)
  321.     {
  322.     SendMessageEx(doorTalk, user1, indy0, 0, 0, 0);
  323.     while (global15 == 0)
  324.         {
  325.         #Wait for line to finish...
  326.         Sleep(0.01);
  327.         }
  328.     # Turn whip flags off of probe.
  329.     ClearThingFlags(probe0, 0x00000008);        
  330.     ClearThingFlags(probe0, 0x80000000);        
  331.     ClearThingFlags(probeA, 0x00000008);        
  332.     ClearThingFlags(probeA, 0x80000000);        
  333.  
  334.     # Return to normal.
  335.     CopyOrientandPos(indy0, player);
  336.     SetCurrentCamera(1);
  337.     SetCameraFocus(1, player);
  338.     SetCameraFOV(90, 0, 0.0);
  339.     ClearActorFlags(player, 0x200000);
  340.     SetThingFlags(indy0, 0x80000);
  341.     ClearThingFlags(player, 0x80000);
  342.     
  343.     Sleep(0.01);
  344.  
  345.     EndCutScene();
  346.     }
  347.  
  348. return;
  349.  
  350. # ........................................................................................
  351. wrongwhip:
  352.  
  353. # Subroutine for when wrong whip is used.
  354. SendMessageEx(doorTalk, user3, indy0, 0, 0, 0);
  355. while (global15 == 0)
  356.     {
  357.     #Wait for line to finish...
  358.     Sleep(0.01);
  359.     }
  360.  
  361. # Return to normal.
  362. CopyOrientandPos(indy0, player);
  363. SetCurrentCamera(1);
  364. SetCameraFocus(1, player);
  365. SetCameraFOV(90, 0, 0.0);
  366. ClearActorFlags(player, 0x200000);
  367. SetThingFlags(indy0, 0x80000);
  368. ClearThingFlags(player, 0x80000);
  369.  
  370. done1 = 0;
  371.  
  372. EndCutScene();
  373.  
  374. return;
  375.  
  376. # ........................................................................................
  377. end
  378.  
  379.